#ifndef DBSCAN_H
#define DBSCAN_H
#include <vector>
#include <boost/numeric/ublas/matrix.hpp>

#include "clusters.h"

namespace Clustering{
	//template <typename Distance_type>
	class DBSCAN : public Clusters
	{
	public:
		//args : points, distance min, min number of points in clusters
		
		DBSCAN(Points & ps, long double eps, unsigned int minPts)
			: Clusters(ps),_eps(eps),_minPts(minPts)
		{
			_noise.resize(ps.get_num(), false);
			_visited.resize(ps.get_num(), false);
		};

		

		// 
		// The clustering algo
		//
		
		void run_cluster(Metrics::Distance<Metrics::MeterDistance<Clustering::Point>> & d, long double thresholdGeo, long double thresholdTime);

	private:



	// eps radiuus
	// Two points are neighbors if the distance 
	// between them does not exceed threshold value.
		long double _eps;

	//minimum number of points
		unsigned int _minPts;

	// noise vector
		//std::vector<bool> _noise;
		LinList<bool> _noise;

	// noise vector
		//std::vector<bool> _visited;
		LinList<bool> _visited;

		

	};



	
	static bool isPresent(LinList<unsigned int> *lpid, PointId * d){

		LinList<unsigned int>* tempList = new LinList<unsigned int>(*lpid);

		unsigned int* currentData = tempList->get_first();
								
		while(currentData != NULL){														
		
			if((*currentData) == (*d)){
				
				return true;
			}
			
			currentData = tempList->get_next();
								
		}

		return false;
	}
	

};
#endif